﻿using App.DAL;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using App.Components;

namespace App.Components
{
    public class BaseController : Controller
    {

        public virtual ActionResult Content<T>(List<T> list) where T : class, IExport
        {
            var obj = new LayUIGridResult(list.Cast(x => x.Export()));
            return Content(obj.ToJson());
        }
        public virtual ActionResult Content<T>(List<T> list,LayUIPagination page) where T : class, IExport
        {
            var obj = new LayUIGridResult(list.Cast(x => x.Export()));
            obj.count = page.count;
            return Content(obj.ToJson());
        }
    }
}
